
import downFileFromServer from "@/utils/downFileFromServer"

/**
 * 渲染文件
 * @param {*} text 
 * @returns 
 */
function FileRender({ text }) {
  if (!text) {
    return (<div>无文件</div>)
  }

  let handleClick = async () => {
    try {
      await downFileFromServer(text)

    } catch (error) {
      message.error(`下载文件失败：${error.message}`)
    }

  }

  return (
    <div onClick={handleClick} className="list-filedownload">文件下载</div>
  )
}

export default FileRender
